passthrough: use domain pirq as index of struct hvm_irq_dpci's hvm_timer array
authorJan Beulich <jbeulich@novell.com>
Tue, 5 Apr 2011 12:05:05 +0000 (13:05 +0100)
committerJan Beulich <jbeulich@novell.com>
Tue, 5 Apr 2011 12:05:05 +0000 (13:05 +0100)
commit02fea4b6acca5a67283f1aeac5d2596a62e32c90
treec4170735ec1e78b68933ea303a01f3e97d7ccb88
parent2037f2adbf04d7c6dd2b566045e90ccdd5034ee2
passthrough: use domain pirq as index of struct hvm_irq_dpci's hvm_timer array

Since d->nr_pirqs is guaranteed to be not larger than nr_irqs,
indexing arrays by the former ought to be preferred. In the case
given, the indices so far had to be computed specially in a number of
cases, whereas the indexes use now are all readily available.

This opens the possibility to fold the ->mirq[] and ->hvm_timer[]
members of struct hvm_irq_dpci into a single array, possibly with some
members overlayed in a union to reduce size (see
http://lists.xensource.com/archives/html/xen-devel/2011-03/msg02006.html).
Such space saving wouldn't, however, suffice to generally get the
respective allocation sizes here to below PAGE_SIZE, not even when
converting the array of structures into an array of pointers to
structures. Whether a multi-level lookup mechanism would make sense
here is questionable, as it can be expected that for other than Dom0
(which isn't hvm, and hence shouldn't use these data structures - see
http://lists.xensource.com/archives/html/xen-devel/2011-03/msg02004.html)
only very few entries would commonly be used here. An obvious
alternative would be to use rb or radix trees (both currently only
used in tmem).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/drivers/passthrough/io.c
xen/drivers/passthrough/pci.c
xen/drivers/passthrough/vtd/x86/vtd.c